package it.uni.bo.monitoring.sla.chain.availability;

import static it.uni.bo.monitoring.service.StaticFields.FAILB;

import it.uni.bo.monitoring.protocol.unmarshaller.EventInfo;
import it.uni.bo.monitoring.sla.context.ComponentManager;
import it.uni.bo.monitoring.sla.context.MonitoringComponent;
import it.uni.bo.monitoring.sla.context.MonitoringContext;

import java.util.List;


public class MonitoringReliability extends MonitoringComponent{

	public MonitoringReliability() {
	}

	@Override
	public void processEvent(EventInfo ei, MonitoringContext mc) {
		if(ei.getDirection()==(Character.forDigit(FAILB & 0xFF, 2))){
			List<ComponentManager> ratList=mc.getAutomatonReliabilityList();
			if ( ratList != null ){
				for(int i=0;i<ratList.size();i++)
					ratList.get(i).makeTrans(ei);
			}
		}
		if(next!=null)
			next.processEvent(ei, mc);
	}

}
